<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: BaseLayer Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00025.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-attribs">Static Public Attributes</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="#pri-methods">Private Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">BaseLayer Class Reference<div class="ingroups"><a class="el" href="a00516.html">baseModules - base module classes of MiXiM</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="BaseLayer" --><!-- doxytag: inherits="MiximBatteryAccess" -->
<p>A very simple layer template.  
 <a href="a00025.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="a00268_source.html">BaseLayer.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for BaseLayer:</div>
<div class="dyncontent">
<div class="center"><img src="a00587.png" border="0" usemap="#BaseLayer_inherit__map" alt="Inheritance graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for BaseLayer:</div>
<div class="dyncontent">
<div class="center"><img src="a00588.png" border="0" usemap="#BaseLayer_coll__map" alt="Collaboration graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="a00589.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0afd7ae9809a632ee75a136838029c07"></a><!-- doxytag: member="BaseLayer::BaseLayer" ref="a0afd7ae9809a632ee75a136838029c07" args="(unsigned stacksize)" -->
&#160;</td><td class="memItemRight" valign="bottom"><b>BaseLayer</b> (unsigned stacksize)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#a70f5ea30a9980d57b8384faed29ec3eb">initialize</a> (int)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialization of the module and some variables.  <a href="#a70f5ea30a9980d57b8384faed29ec3eb"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#a8039dac8d02052c97c1fcc209910fdde">handleMessage</a> (cMessage *)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Called every time a message arrives.  <a href="#a8039dac8d02052c97c1fcc209910fdde"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5ab11502dbeeea89693d29841376a2f7"></a><!-- doxytag: member="BaseLayer::finish" ref="a5ab11502dbeeea89693d29841376a2f7" args="()" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#a5ab11502dbeeea89693d29841376a2f7">finish</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Called when the simulation has finished. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pub-static-attribs"></a>
Static Public Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a665bf8ad06b2c4b5419669869e68ef00"></a><!-- doxytag: member="BaseLayer::catPacketSignal" ref="a665bf8ad06b2c4b5419669869e68ef00" args="" -->
static const <a class="el" href="a00201.html">simsignalwrap_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#a665bf8ad06b2c4b5419669869e68ef00">catPacketSignal</a> = <a class="el" href="a00201.html">simsignalwrap_t</a>(MIXIM_SIGNAL_PACKET_NAME)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">SignalID for packets. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8474b0b98731b2d66c9fe3a3ae040edd"></a><!-- doxytag: member="BaseLayer::catPassedMsgSignal" ref="a8474b0b98731b2d66c9fe3a3ae040edd" args="" -->
static const <a class="el" href="a00201.html">simsignalwrap_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#a8474b0b98731b2d66c9fe3a3ae040edd">catPassedMsgSignal</a> = <a class="el" href="a00201.html">simsignalwrap_t</a>(MIXIM_SIGNAL_PASSEDMSG_NAME)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a> for passed messages. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad8ba02d92dd106da1d85192eb28250c0"></a><!-- doxytag: member="BaseLayer::catDroppedPacketSignal" ref="ad8ba02d92dd106da1d85192eb28250c0" args="" -->
static const <a class="el" href="a00201.html">simsignalwrap_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#ad8ba02d92dd106da1d85192eb28250c0">catDroppedPacketSignal</a> = <a class="el" href="a00201.html">simsignalwrap_t</a>(MIXIM_SIGNAL_DROPPEDPACKET_NAME)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a> for dropped packets. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Handle Messages</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p>Functions to be redefined by the programmer</p>
<p>These are the functions provided to add own functionality to your modules. These functions are called whenever a self message or a data message from the upper or lower layer arrives respectively. </p>
</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a87d7e1e5aa73216f07e35d7be4358924"></a><!-- doxytag: member="BaseLayer::handleSelfMsg" ref="a87d7e1e5aa73216f07e35d7be4358924" args="(cMessage *msg)=0" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#a87d7e1e5aa73216f07e35d7be4358924">handleSelfMsg</a> (cMessage *msg)=0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle self messages such as timer... <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#a8c0fcfb2e806357a65d5bdb1c338627b">handleUpperMsg</a> (cMessage *msg)=0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle messages from upper layer.  <a href="#a8c0fcfb2e806357a65d5bdb1c338627b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5ca2278405070baa474dfbf059930247"></a><!-- doxytag: member="BaseLayer::handleLowerMsg" ref="a5ca2278405070baa474dfbf059930247" args="(cMessage *msg)=0" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#a5ca2278405070baa474dfbf059930247">handleLowerMsg</a> (cMessage *msg)=0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle messages from lower layer. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa37925527fae20a5de1a755103056219"></a><!-- doxytag: member="BaseLayer::handleLowerControl" ref="aa37925527fae20a5de1a755103056219" args="(cMessage *msg)=0" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#aa37925527fae20a5de1a755103056219">handleLowerControl</a> (cMessage *msg)=0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle control messages from lower layer. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab412568faae75040194e01d5e541dd67"></a><!-- doxytag: member="BaseLayer::handleUpperControl" ref="ab412568faae75040194e01d5e541dd67" args="(cMessage *msg)=0" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#ab412568faae75040194e01d5e541dd67">handleUpperControl</a> (cMessage *msg)=0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle control messages from upper layer. <br/></td></tr>
<tr><td colspan="2"><div class="groupHeader">Convenience Functions</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p>Functions for convenience - NOT to be modified</p>
<p>These are functions taking care of message encapsulation and message sending. Normally you should not need to alter these.</p>
<p>All these functions assume that YOU do all the necessary handling of control information etc. before you use them. </p>
</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#a1873d6e3fc6d92cf8482b39f1c5ac6c8">sendDown</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends a message to the lower layer.  <a href="#a1873d6e3fc6d92cf8482b39f1c5ac6c8"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#adbf061566606041db811b519f0400ed5">sendUp</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends a message to the upper layer.  <a href="#adbf061566606041db811b519f0400ed5"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa1190a06fb4dfb15d8ff001468335dc8"></a><!-- doxytag: member="BaseLayer::sendControlUp" ref="aa1190a06fb4dfb15d8ff001468335dc8" args="(cMessage *msg)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#aa1190a06fb4dfb15d8ff001468335dc8">sendControlUp</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends a control message to an upper layer. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6d01a0f56978740d7617c2e338858cc3"></a><!-- doxytag: member="BaseLayer::sendControlDown" ref="a6d01a0f56978740d7617c2e338858cc3" args="(cMessage *msg)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#a6d01a0f56978740d7617c2e338858cc3">sendControlDown</a> (cMessage *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends a control message to a lower layer. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a33f4f320f4b6c4ec48651847338ff47f"></a><!-- doxytag: member="BaseLayer::recordPacket" ref="a33f4f320f4b6c4ec48651847338ff47f" args="(PassedMessage::direction_t dir, PassedMessage::gates_t gate, const cMessage *m)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><b>recordPacket</b> (PassedMessage::direction_t dir, PassedMessage::gates_t gate, const cMessage *m)</td></tr>
<tr><td colspan="2"><h2><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adf7be46c3b45429ae7e45c466202eebd"></a><!-- doxytag: member="BaseLayer::passedMsg" ref="adf7be46c3b45429ae7e45c466202eebd" args="" -->
<a class="el" href="a00170.html">PassedMessage</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#adf7be46c3b45429ae7e45c466202eebd">passedMsg</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The last message passed through this layer. This variable will be only not NULL if we are in statistic recording mode. <br/></td></tr>
<tr><td colspan="2"><div class="groupHeader">gate ids</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa73b04b4b90c5d44adf7b1ea1264412d"></a><!-- doxytag: member="BaseLayer::upperLayerIn" ref="aa73b04b4b90c5d44adf7b1ea1264412d" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>upperLayerIn</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6a901380d0b82b72898cad4ba6cff331"></a><!-- doxytag: member="BaseLayer::upperLayerOut" ref="a6a901380d0b82b72898cad4ba6cff331" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>upperLayerOut</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abf4366df3282b3358945a3267538b93a"></a><!-- doxytag: member="BaseLayer::lowerLayerIn" ref="abf4366df3282b3358945a3267538b93a" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>lowerLayerIn</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa77fd3b24dc3caec970d7f5c48626e52"></a><!-- doxytag: member="BaseLayer::lowerLayerOut" ref="aa77fd3b24dc3caec970d7f5c48626e52" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>lowerLayerOut</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aba75bba311458c62b4b2fa2bb9711a91"></a><!-- doxytag: member="BaseLayer::upperControlIn" ref="aba75bba311458c62b4b2fa2bb9711a91" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>upperControlIn</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5e0a6cb17bfc2fd3127ac884d0e9d3c8"></a><!-- doxytag: member="BaseLayer::upperControlOut" ref="a5e0a6cb17bfc2fd3127ac884d0e9d3c8" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>upperControlOut</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1d2eb99059680b97b366ae8342f18af5"></a><!-- doxytag: member="BaseLayer::lowerControlIn" ref="a1d2eb99059680b97b366ae8342f18af5" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>lowerControlIn</b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a380159410191c5ea0e5f95766a4814dd"></a><!-- doxytag: member="BaseLayer::lowerControlOut" ref="a380159410191c5ea0e5f95766a4814dd" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><b>lowerControlOut</b></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae32ebb422e76d38e48231ebd84fe772b"></a><!-- doxytag: member="BaseLayer::BaseLayer" ref="ae32ebb422e76d38e48231ebd84fe772b" args="(const BaseLayer &amp;)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#ae32ebb422e76d38e48231ebd84fe772b">BaseLayer</a> (const <a class="el" href="a00025.html">BaseLayer</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor is not allowed. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a063fda133f5220b9db525cd32c6d683b"></a><!-- doxytag: member="BaseLayer::operator=" ref="a063fda133f5220b9db525cd32c6d683b" args="(const BaseLayer &amp;)" -->
<a class="el" href="a00025.html">BaseLayer</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00025.html#a063fda133f5220b9db525cd32c6d683b">operator=</a> (const <a class="el" href="a00025.html">BaseLayer</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Assignment operator is not allowed. <br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>A very simple layer template. </p>
<p>This module provides basic abstractions that ease development of a network or MAC layer.</p>
<dl class="author"><dt><b>Author:</b></dt><dd>Andreas Koepke </dd></dl>
</div><hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a8039dac8d02052c97c1fcc209910fdde"></a><!-- doxytag: member="BaseLayer::handleMessage" ref="a8039dac8d02052c97c1fcc209910fdde" args="(cMessage *)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BaseLayer::handleMessage </td>
          <td>(</td>
          <td class="paramtype">cMessage *&#160;</td>
          <td class="paramname"><em>msg</em></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Called every time a message arrives. </p>
<p>The basic handle message function.</p>
<p>Depending on the gate a message arrives handleMessage just calls different handle*Msg functions to further process the message.</p>
<p>You should not make any changes in this function but implement all your functionality into the handle*Msg functions called from here.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="a00025.html#a8c0fcfb2e806357a65d5bdb1c338627b" title="Handle messages from upper layer.">handleUpperMsg</a>, <a class="el" href="a00025.html#a5ca2278405070baa474dfbf059930247" title="Handle messages from lower layer.">handleLowerMsg</a>, <a class="el" href="a00025.html#a87d7e1e5aa73216f07e35d7be4358924" title="Handle self messages such as timer...">handleSelfMsg</a> </dd></dl>

<p>References <a class="el" href="a00025.html#aa37925527fae20a5de1a755103056219">handleLowerControl()</a>, <a class="el" href="a00025.html#a5ca2278405070baa474dfbf059930247">handleLowerMsg()</a>, <a class="el" href="a00025.html#a87d7e1e5aa73216f07e35d7be4358924">handleSelfMsg()</a>, <a class="el" href="a00025.html#ab412568faae75040194e01d5e541dd67">handleUpperControl()</a>, and <a class="el" href="a00025.html#a8c0fcfb2e806357a65d5bdb1c338627b">handleUpperMsg()</a>.</p>
<div class="fragment"><pre class="fragment">{
    <span class="keywordflow">if</span> (msg-&gt;isSelfMessage()) {
        <a class="code" href="a00025.html#a87d7e1e5aa73216f07e35d7be4358924" title="Handle self messages such as timer...">handleSelfMsg</a>(msg);
    } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(msg-&gt;getArrivalGateId()==upperLayerIn) {
        recordPacket(PassedMessage::INCOMING,PassedMessage::UPPER_DATA,msg);
        <a class="code" href="a00025.html#a8c0fcfb2e806357a65d5bdb1c338627b" title="Handle messages from upper layer.">handleUpperMsg</a>(msg);
    } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(msg-&gt;getArrivalGateId()==upperControlIn) {
        recordPacket(PassedMessage::INCOMING,PassedMessage::UPPER_CONTROL,msg);
        <a class="code" href="a00025.html#ab412568faae75040194e01d5e541dd67" title="Handle control messages from upper layer.">handleUpperControl</a>(msg);
    } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(msg-&gt;getArrivalGateId()==lowerControlIn){
        recordPacket(PassedMessage::INCOMING,PassedMessage::LOWER_CONTROL,msg);
        <a class="code" href="a00025.html#aa37925527fae20a5de1a755103056219" title="Handle control messages from lower layer.">handleLowerControl</a>(msg);
    } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(msg-&gt;getArrivalGateId()==lowerLayerIn) {
        recordPacket(PassedMessage::INCOMING,PassedMessage::LOWER_DATA,msg);
        <a class="code" href="a00025.html#a5ca2278405070baa474dfbf059930247" title="Handle messages from lower layer.">handleLowerMsg</a>(msg);
    }
    <span class="keywordflow">else</span> <span class="keywordflow">if</span>(msg-&gt;getArrivalGateId()==-1) {
        <span class="comment">/* Classes extending this class may not use all the gates, f.e.</span>
<span class="comment">         * BaseApplLayer has no upper gates. In this case all upper gate-</span>
<span class="comment">         * handles are initialized to -1. When getArrivalGateId() equals -1,</span>
<span class="comment">         * it would be wrong to forward the message to one of these gates,</span>
<span class="comment">         * as they actually don&#39;t exist, so raise an error instead.</span>
<span class="comment">         */</span>
        opp_error(<span class="stringliteral">&quot;No self message and no gateID?? Check configuration.&quot;</span>);
    } <span class="keywordflow">else</span> {
        <span class="comment">/* msg-&gt;getArrivalGateId() should be valid, but it isn&#39;t recognized</span>
<span class="comment">         * here. This could signal the case that this class is extended</span>
<span class="comment">         * with extra gates, but handleMessage() isn&#39;t overridden to</span>
<span class="comment">         * check for the new gate(s).</span>
<span class="comment">         */</span>
        opp_error(<span class="stringliteral">&quot;Unknown gateID?? Check configuration or override handleMessage().&quot;</span>);
    }
}
</pre></div>
</div>
</div>
<a class="anchor" id="a8c0fcfb2e806357a65d5bdb1c338627b"></a><!-- doxytag: member="BaseLayer::handleUpperMsg" ref="a8c0fcfb2e806357a65d5bdb1c338627b" args="(cMessage *msg)=0" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual void BaseLayer::handleUpperMsg </td>
          <td>(</td>
          <td class="paramtype">cMessage *&#160;</td>
          <td class="paramname"><em>msg</em></td><td>)</td>
          <td><code> [protected, pure virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Handle messages from upper layer. </p>
<p>This function is pure virtual here, because there is no reasonable guess what to do with it by default. </p>

<p>Implemented in <a class="el" href="a00227.html#aca0392ef347f060c9950238620245357">WiseRoute</a>, <a class="el" href="a00069.html#a06c96c060afdff5c0f348b5ebef5c54d">CSMAMacLayer</a>, <a class="el" href="a00026.html#a6de2ca07018de313a7147a03e6d77bff">BaseMacLayer</a>, <a class="el" href="a00016.html#a29c15eb83ed7749c838c005a3fb554d4">BaseApplLayer</a>, <a class="el" href="a00191.html#a999fc38567d79965df17646dcbf38e84">SensorApplLayer</a>, <a class="el" href="a00094.html#a37fea31a3b2493ee86f1b3efa7dd885a">Flood</a>, <a class="el" href="a00028.html#a0b473fbb2517ac7b0c633afdb002c269">BaseNetwLayer</a>, <a class="el" href="a00067.html#ad85c18d90e41eb2074593a44b64ab855">csma</a>, <a class="el" href="a00126.html#a7de5ee6f865e3ae8e7a9841291d36a37">LMacLayer</a>, <a class="el" href="a00128.html#af7e230f8713536482417699f2f6bee71">Mac80211</a>, <a class="el" href="a00156.html#aa27138585461e46f30446c79fd273cd5">NetworkStackTrafficGen</a>, <a class="el" href="a00035.html#a43c9f5377b89dd4cd4e4e48fb3e96107">BMacLayer</a>, <a class="el" href="a00180.html#a7bf4d5846300082695448feb01b9899e">ProbabilisticBroadcast</a>, <a class="el" href="a00005.html#a9723e5a17551e41ae8a7de5078f6ac7f">Aggregation</a>, and <a class="el" href="a00089.html#afd462238bd49ed699157a22acc4b4d15">DummyRoute</a>.</p>

<p>Referenced by <a class="el" href="a00025.html#a8039dac8d02052c97c1fcc209910fdde">handleMessage()</a>.</p>

</div>
</div>
<a class="anchor" id="a70f5ea30a9980d57b8384faed29ec3eb"></a><!-- doxytag: member="BaseLayer::initialize" ref="a70f5ea30a9980d57b8384faed29ec3eb" args="(int)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BaseLayer::initialize </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>stage</em></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Initialization of the module and some variables. </p>
<p>First we have to initialize the module from which we derived ours, in this case <a class="el" href="a00027.html" title="Base class for all simple modules of a host.">BaseModule</a>. This module takes care of the gate initialization. </p>

<p>Reimplemented from <a class="el" href="a00027.html#a03030e439aaf030c83da6e71e8be2f80">BaseModule</a>.</p>

<p>Reimplemented in <a class="el" href="a00069.html#a660262c629f33b00401249d3fdac49be">CSMAMacLayer</a>, <a class="el" href="a00026.html#a61c82dc3b225eac37f7fa9936c28c2c3">BaseMacLayer</a>, <a class="el" href="a00094.html#ab47e1d524db55d57edc7f86db5d92735">Flood</a>, <a class="el" href="a00067.html#a24e7a48bd1d9036139c75b558ade4161">csma</a>, <a class="el" href="a00126.html#a2100ca7de5c5eedb3e7f0e11ca9fca14">LMacLayer</a>, <a class="el" href="a00128.html#ab81dae24d79c2ef010301e2c219966c1">Mac80211</a>, <a class="el" href="a00028.html#a1e521b5549bfe29ae94d95265c0fe8d2">BaseNetwLayer</a>, <a class="el" href="a00227.html#ade7fd8114864ff11327435c57cab0e53">WiseRoute</a>, <a class="el" href="a00035.html#aacfdc6bca51f7097b58556fdf1744689">BMacLayer</a>, <a class="el" href="a00217.html#a083fea2270d41c26495fbc8e2bbe95be">TrafficGen</a>, <a class="el" href="a00156.html#a4ad89047bebb99eaad2fd239cbc9e601">NetworkStackTrafficGen</a>, <a class="el" href="a00016.html#aa3ebaf5d1d1bdbec4648b07f65eb4145">BaseApplLayer</a>, <a class="el" href="a00223.html#a0fcaae9c3cefb73372b7290ff4d9092d">UWBIRMac</a>, <a class="el" href="a00191.html#aac9612746afd57f4393658789d3c64fe">SensorApplLayer</a>, <a class="el" href="a00180.html#abf8d4a866267695fc27802ada7862526">ProbabilisticBroadcast</a>, <a class="el" href="a00008.html#abab6939a0c82122391528d386df97c2c">AlohaMacLayer</a>, <a class="el" href="a00040.html#ae693c2f1fc343d8c253778a1de1c4082">BurstApplLayer</a>, <a class="el" href="a00041.html#a8ccaf74e9a310c5f45447283df6dee7e">BurstApplLayerBattery</a>, <a class="el" href="a00005.html#acf3b1cfc2915c422e5a10e7993884b9b">Aggregation</a>, <a class="el" href="a00208.html#a8df32483962ebc40e1eed225716e54cb">TestApplLayer</a>, <a class="el" href="a00089.html#abdee96cebdcaeef041d21f4dd8d90b9d">DummyRoute</a>, <a class="el" href="a00068.html#abbb7175c6f28345ca29c3ca6f98732fc">CSMA802154</a>, <a class="el" href="a00003.html#ad3541d0be9b308c1b72633d25300afdb">AdaptiveProbabilisticBroadcast</a>, and <a class="el" href="a00129.html#aa7351afc794f983e34dbc86d63cb3dea">Mac80211MultiChannel</a>.</p>

<p>References <a class="el" href="a00025.html#ad8ba02d92dd106da1d85192eb28250c0">catDroppedPacketSignal</a>, <a class="el" href="a00025.html#a665bf8ad06b2c4b5419669869e68ef00">catPacketSignal</a>, <a class="el" href="a00025.html#a8474b0b98731b2d66c9fe3a3ae040edd">catPassedMsgSignal</a>, <a class="el" href="a00201.html#aa01f017b96087bc252445206777e0080">simsignalwrap_t::initialize()</a>, and <a class="el" href="a00025.html#adf7be46c3b45429ae7e45c466202eebd">passedMsg</a>.</p>
<div class="fragment"><pre class="fragment">{
    <a class="code" href="a00025.html#a70f5ea30a9980d57b8384faed29ec3eb" title="Initialization of the module and some variables.">MiximBatteryAccess::initialize</a>(stage);
    <span class="keywordflow">if</span>(stage==0) {
        <a class="code" href="a00025.html#adf7be46c3b45429ae7e45c466202eebd" title="The last message passed through this layer. This variable will be only not NULL if we are in statisti...">passedMsg</a> = NULL;
        <span class="keywordflow">if</span> (hasPar(<span class="stringliteral">&quot;stats&quot;</span>) &amp;&amp; par(<span class="stringliteral">&quot;stats&quot;</span>).boolValue()) {
            <a class="code" href="a00025.html#adf7be46c3b45429ae7e45c466202eebd" title="The last message passed through this layer. This variable will be only not NULL if we are in statisti...">passedMsg</a> = <span class="keyword">new</span> <a class="code" href="a00170.html">PassedMessage</a>();
            <span class="keywordflow">if</span> (<a class="code" href="a00025.html#adf7be46c3b45429ae7e45c466202eebd" title="The last message passed through this layer. This variable will be only not NULL if we are in statisti...">passedMsg</a> != NULL) {
                <a class="code" href="a00025.html#adf7be46c3b45429ae7e45c466202eebd" title="The last message passed through this layer. This variable will be only not NULL if we are in statisti...">passedMsg</a>-&gt;fromModule = getId();
            }
        }
        upperLayerIn  = findGate(<span class="stringliteral">&quot;upperLayerIn&quot;</span>);
        upperLayerOut = findGate(<span class="stringliteral">&quot;upperLayerOut&quot;</span>);
        lowerLayerIn  = findGate(<span class="stringliteral">&quot;lowerLayerIn&quot;</span>);
        lowerLayerOut = findGate(<span class="stringliteral">&quot;lowerLayerOut&quot;</span>);
        upperControlIn  = findGate(<span class="stringliteral">&quot;upperControlIn&quot;</span>);
        upperControlOut = findGate(<span class="stringliteral">&quot;upperControlOut&quot;</span>);
        lowerControlIn  = findGate(<span class="stringliteral">&quot;lowerControlIn&quot;</span>);
        lowerControlOut = findGate(<span class="stringliteral">&quot;lowerControlOut&quot;</span>);

        <a class="code" href="a00025.html#a8474b0b98731b2d66c9fe3a3ae040edd" title="Signal for passed messages.">catPassedMsgSignal</a>.<a class="code" href="a00201.html#aa01f017b96087bc252445206777e0080">initialize</a>();
        <a class="code" href="a00025.html#a665bf8ad06b2c4b5419669869e68ef00" title="SignalID for packets.">catPacketSignal</a>.<a class="code" href="a00201.html#aa01f017b96087bc252445206777e0080">initialize</a>();
        <a class="code" href="a00025.html#ad8ba02d92dd106da1d85192eb28250c0" title="Signal for dropped packets.">catDroppedPacketSignal</a>.<a class="code" href="a00201.html#aa01f017b96087bc252445206777e0080">initialize</a>();
    }
}
</pre></div>
</div>
</div>
<a class="anchor" id="a1873d6e3fc6d92cf8482b39f1c5ac6c8"></a><!-- doxytag: member="BaseLayer::sendDown" ref="a1873d6e3fc6d92cf8482b39f1c5ac6c8" args="(cMessage *msg)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BaseLayer::sendDown </td>
          <td>(</td>
          <td class="paramtype">cMessage *&#160;</td>
          <td class="paramname"><em>msg</em></td><td>)</td>
          <td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sends a message to the lower layer. </p>
<p>Short hand for send(msg, lowerLayerOut);</p>
<p>You have to take care of encapsulation We recommend that you use a pair of functions called encapsMsg/decapsMsg. </p>

<p>Referenced by <a class="el" href="a00069.html#a2eb12cedf0b4b5e6fda8bd6666186cb6">CSMAMacLayer::handleLowerControl()</a>, <a class="el" href="a00094.html#ac8c12c3b58ff0f5092b2326f694a509e">Flood::handleLowerMsg()</a>, <a class="el" href="a00227.html#a30099bfda16298ba45f76f4ba2fb0985">WiseRoute::handleLowerMsg()</a>, <a class="el" href="a00180.html#a617c3e0c1a2179b6b560c2286732b2ad">ProbabilisticBroadcast::handleSelfMsg()</a>, <a class="el" href="a00126.html#a2397193676d296cc6757b31eef203bb3">LMacLayer::handleSelfMsg()</a>, <a class="el" href="a00227.html#a4f0df1761deb1e98784b416ea17fc1e7">WiseRoute::handleSelfMsg()</a>, <a class="el" href="a00089.html#afd462238bd49ed699157a22acc4b4d15">DummyRoute::handleUpperMsg()</a>, <a class="el" href="a00005.html#a9723e5a17551e41ae8a7de5078f6ac7f">Aggregation::handleUpperMsg()</a>, <a class="el" href="a00028.html#a0b473fbb2517ac7b0c633afdb002c269">BaseNetwLayer::handleUpperMsg()</a>, <a class="el" href="a00094.html#a37fea31a3b2493ee86f1b3efa7dd885a">Flood::handleUpperMsg()</a>, <a class="el" href="a00026.html#a6de2ca07018de313a7147a03e6d77bff">BaseMacLayer::handleUpperMsg()</a>, <a class="el" href="a00227.html#aca0392ef347f060c9950238620245357">WiseRoute::handleUpperMsg()</a>, <a class="el" href="a00128.html#a1c404a5176db493c2fefb71537783607">Mac80211::sendACKframe()</a>, <a class="el" href="a00208.html#aacf2004acd42e50fe4c46bdc3dcffbc2">TestApplLayer::sendBroadcast()</a>, <a class="el" href="a00217.html#a246eb89973ae5af45a3c7ee7279e9777">TrafficGen::sendBroadcast()</a>, <a class="el" href="a00156.html#adc1d59fcef6f3bc66765feb3c642a1bf">NetworkStackTrafficGen::sendBroadcast()</a>, <a class="el" href="a00128.html#a26b30d048980b56d79c04e859bfce009">Mac80211::sendBROADCASTframe()</a>, <a class="el" href="a00128.html#a1fd59a589e53facb68c13be84521a49e">Mac80211::sendCTSframe()</a>, <a class="el" href="a00191.html#a874cfc7ac28f9b46f51eea860536ab59">SensorApplLayer::sendData()</a>, <a class="el" href="a00128.html#a7a4ff22b4b999827a898794923115880">Mac80211::sendDATAframe()</a>, <a class="el" href="a00035.html#a2f19dac6f5e7041c9b65a1e547763ffa">BMacLayer::sendDataPacket()</a>, <a class="el" href="a00035.html#af2a4df90f60f2c5b93813b5424f7ee0f">BMacLayer::sendMacAck()</a>, <a class="el" href="a00035.html#afeb78e201913f491b8abb8416dd6eefc">BMacLayer::sendPreamble()</a>, and <a class="el" href="a00128.html#a3104750758ab171b20ffcfeae0079a78">Mac80211::sendRTSframe()</a>.</p>
<div class="fragment"><pre class="fragment">{
    recordPacket(PassedMessage::OUTGOING,PassedMessage::LOWER_DATA,msg);
    send(msg, lowerLayerOut);
}
</pre></div>
</div>
</div>
<a class="anchor" id="adbf061566606041db811b519f0400ed5"></a><!-- doxytag: member="BaseLayer::sendUp" ref="adbf061566606041db811b519f0400ed5" args="(cMessage *msg)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BaseLayer::sendUp </td>
          <td>(</td>
          <td class="paramtype">cMessage *&#160;</td>
          <td class="paramname"><em>msg</em></td><td>)</td>
          <td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sends a message to the upper layer. </p>
<p>Short hand for send(msg, upperLayerOut); You have to take care of decapsulation and deletion of superflous frames. We recommend that you use a pair of functions decapsMsg/encapsMsg. </p>

<p>Referenced by <a class="el" href="a00128.html#adfcf8b7a5e1db233a1bd717cecaf49bd">Mac80211::handleBroadcastMsg()</a>, <a class="el" href="a00128.html#ab0844f9dbcece750c9a58ca9f0a73fe1">Mac80211::handleDATAframe()</a>, <a class="el" href="a00089.html#a33f1e68f09911942c05a83bb913c9f30">DummyRoute::handleLowerMsg()</a>, <a class="el" href="a00005.html#ab3b44d15baaa9f4df289db09b80d4e52">Aggregation::handleLowerMsg()</a>, <a class="el" href="a00180.html#afe7ebec835c0816b263c52a622a655da">ProbabilisticBroadcast::handleLowerMsg()</a>, <a class="el" href="a00028.html#a58afc64e0a96fe4d80d6b9f53cfd53c6">BaseNetwLayer::handleLowerMsg()</a>, <a class="el" href="a00094.html#ac8c12c3b58ff0f5092b2326f694a509e">Flood::handleLowerMsg()</a>, <a class="el" href="a00026.html#a413375cec02b990a521b62086a02264c">BaseMacLayer::handleLowerMsg()</a>, <a class="el" href="a00069.html#a83911b5673de047bcfc3c9b0a719ff15">CSMAMacLayer::handleLowerMsg()</a>, <a class="el" href="a00227.html#a30099bfda16298ba45f76f4ba2fb0985">WiseRoute::handleLowerMsg()</a>, <a class="el" href="a00035.html#a0d6b089a3e75932385bf38815b44b8bc">BMacLayer::handleSelfMsg()</a>, and <a class="el" href="a00126.html#a2397193676d296cc6757b31eef203bb3">LMacLayer::handleSelfMsg()</a>.</p>
<div class="fragment"><pre class="fragment">{
    recordPacket(PassedMessage::OUTGOING,PassedMessage::UPPER_DATA,msg);
    send(msg, upperLayerOut);
}
</pre></div>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>D:/Projects/MiXiM/extsrc/mixim/src/base/modules/<a class="el" href="a00268_source.html">BaseLayer.h</a></li>
<li>D:/Projects/MiXiM/extsrc/mixim/src/base/modules/BaseLayer.cc</li>
</ul>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="a00025.html">BaseLayer</a>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:31 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
